<?php
// application/modules/admin/controllers/IndexController.php
/**
 * demo-zf application
 *
 * admin\Admin_IndexController
 *
 * @author Adam Pilacki <adam.pilacki@gmail.com>
 */
class Admin_IndexController
    extends Lib_Admin_ActionAbstract
{
    public function init()
    {
        parent::init();
        $this->_sessionNamespace->lastPage = '/admin';
    }

    public function indexAction()
    {
    }

    /**
     * Switches language to chosen
     */
    public final function switchLanguageAction()
    {
        $lang = $this->_getParam('lang', Zend_Registry::get('config')->resources->translate->defaultLang);
        if (Resource_Translate::isLanguageValid($lang)) {
            $this->_sessionNamespace->lang = $lang;
        }
        $lastPage = isset($this->_sessionNamespace->lastPage) ? $this->_sessionNamespace->lastPage : '/';
        $this->_sessionNamespace->lastPage = '/admin';
        $this->_redirect($lastPage);
    }
}